<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Encrypt The Cloud Tests</title>
        <script src="../lib/jquery/jquery.js" type="text/javascript"></script>
        <link rel="stylesheet" href="qunit/qunit.css" type="text/css" media="screen" />
        <script type="text/javascript" src="qunit/qunit.js"></script>
        <script src="../js/encrypt-the-cloud.js" type="text/javascript"></script>
        <script src="../js/utils.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function(){

                test("domainOf", function(){
                    equals(domainOf("http://www.google.de"),"www.google.de");
					equals(domainOf("http://www.google.de/toll/bla"),"www.google.de");
                });

                test("cleanSitePattern", function(){
                    equals("google", cleanSitePattern("google"));
					equals("/google", cleanSitePattern("/google"));
					equals("taz", cleanSitePattern("http://taz"));
                });
            
                test("isSitePatternMatchingLocation", function(){
                    var location = {
                        host: 'www.google.de',
                        href: 'www.google.de/nora'
                    }
                    equals(true, isSitePatternMatchingLocation("google", location))
                    equals(false, isSitePatternMatchingLocation("nora", location))
					equals(true, isSitePatternMatchingLocation("/nora", location))
                    
                    
                });
                
                test("removeFromArray", function(){
                    a = [1, 5, 7]
                    removeFromArray(a, 5);
                    same([1, 7], a);
                    
                    a = [1, 5, "hallo"]
                    removeFromArray(a, "hallo");
                    same([1, 5], a);
                    
                    a = [5]
                    removeFromArray(a, 5);
                    same([], a);
                    
                    a = [5, 5]
                    removeFromArray(a, 5);
                    same([5], a);
                    
                });
                
                test("addSpaces", function(){
                    equals("1234567 89", addSpaces("123456789"));
                });
                
                test("styleTextBox keeps orginal width", function(){
                    textarea = $('#textarea1');
                    originalWidth = textarea.outerWidth();
                    
                    styleTextBox(textarea);
                    
                    equals(textarea.outerWidth(), originalWidth);
                    
                });
                
            });
        </script>
    </head>
    <body>
        <h1 id="qunit-header">Encrypt The Cloud Tests</h1>
        <h2 id="qunit-banner"></h2>
        <h2 id="qunit-userAgent"></h2>
        <ol id="qunit-tests">
        </ol>
        <div>
            <textarea id="textarea1" style="padding:5px;border-width:1px;width:100px;">
            </textarea>
        </div>
    </body>
</html>
